<template>
    <z-paging :use-virtual-list="true" :auto-show-back-to-top="true" :loading-full-fixed="true"
        :auto-show-system-loading="true" ref="pagingRef" @query="queryListFn">
        <template #cell="{ item, index }">
            <!-- 循环列表 写你的单个布局 item 就是循环的每一项 -->
            <lh-list-item :title="item.Name" :isDh="false" :no="item.StationId" noTitle='站点编号'
                :address="item.District + item.Town + (item.Village ? item.Village : '') + '组'"
                @routerTo="routerTo(item)">

            </lh-list-item>
        </template>
        <template #empty>
            <uv-empty mode="list" marginTop="0rpx" iconSize="180" textSize="28"></uv-empty>
        </template>
    </z-paging>
</template>

<script lang="ts" setup>
import { GetQxStationPage_API } from '@/server/home'
let adcode = undefined
onLoad((e) => {
    adcode = e.adcode
})

const pagingRef = ref()
/**
 * 获取数据
 * @param pageNo 当前页
 * @param pageSize 条数
 */
const queryListFn = async (pageNo: any, pageSize: any) => {
    const params = {
        pageNumber: pageNo,
        pageSize: pageSize,
        AdminCode: adcode,
    }
    try {
        const res = await GetQxStationPage_API(params)
        if (res.IsSuccess) {
            pagingRef.value.complete(res.Data.Data)
        }
    } catch (error) {
        pagingRef.value.complete(false)
    }
}
const routerTo = (item) => {
    // uni.navigateTo({
    //     url: `/pages/home/details/device?jcode=${item.Jcdbh}`,
    // })
}


</script>

<style lang="scss" scoped></style>
